import React from 'react'
import { useLocation, useParams } from 'react-router-dom'
import qs from 'qs'
export default function List() {
  //console.log(Location);
  //通过useLocation 拿到查询字符串的值
  const Location = useLocation()
  const { user } = qs.parse(Location.search.split('?')[1])
  //通过userparams传参的值 渲染不同的页面
  const state = Location.state //
  return (
    <div>
      {
        state.map(item => {
          return <li key={item.id}>{item.name} </li>
        })
      }
    </div>
  )
}
